<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('超限记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                <li class="select-time">
                  <p>时间：</p>
                  <input type="text" class="time-input" id="startDate" placeholder="开始时间" name="startDate"  />
                  <span>-</span>
                  <input type="text" class="time-input" id="endDate" placeholder="结束时间" name="endDate" />
                </li>
                <li>
					 测点：<input type="text" name="tagname" />
				</li>
                
                            <li class="select-time">
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="self:self:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
       var queryFlag = [[${@permission.hasPermi('overrun:tagcount:list')}]];
        var editFlag = [[${@permission.hasPermi('self:self:edit')}]];
        var removeFlag = [[${@permission.hasPermi('self:self:remove')}]];
        var caltypeDatas = [[${@dict.getType('sys_tag_caltype')}]];
        var limittypeDatas = [[${@dict.getType('sys_tag_limittype')}]];
        var datatypeDatas = [[${@dict.getType('oos_overrun_datatype')}]];
        var levelDatas = [[${@dict.getType('oos_overrun_level')}]];
        var prefix = ctx + "self/overRecordself";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "超限记录",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : '主键',
                    visible: false
                },
               
                {
                    field : 'tagname', 
                    title : '测点名称'
                },
                {
                    field : 'pitagname', 
                    title : 'PI测点名称'
                },
               
                {
                    field : 'starttime', 
                    title : '开始时间'
                },
                {
                    field : 'endtime', 
                    title : '结束时间'
                },
                {
                    field : 'times', 
                    title : '超限时长(分)'
                },
                
                {
                    field : 'limitval', 
                    title : '限值',
                    width : 100,
                    align: 'center'
                },
               
                {
                    field : 'level', 
                    title : '超限程度',
                    width : 120,
                    align: 'center',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(levelDatas, value);
                    }
                },
                {
                	 field : 'calctype', 
                     title : '计算类型',
                     width : 120,
                     align: 'center',
                     formatter: function(value, row, index) {
                         return $.table.selectDictLabel(caltypeDatas, value);
                      }
                },
                {
                	 field : 'limittype', 
                     title : '限值类型',
                     width : 120,
                     align: 'center',
                     formatter: function(value, row, index) {
                         return $.table.selectDictLabel(limittypeDatas, value);
                      }
                },
                {
                	 field : 'datatype', 
                     title : '数据类型',
                     width : 120,
                     align: 'center',
                     formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datatypeDatas, value);
                     }
                }, {
              	  title: '操作',
            	  width : 150,
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-info btn-xs ' + queryFlag + '" href="javascript:void(0)" onclick="viewChart(\'' + row.id + '\')"><i class="fa fa-remove"></i>查看</a>');
                    return actions.join('');
                }
              }]
                
            };
            $.table.init(options);
        });
    	// 测点图表操作
		function viewChart(id) {
			var url = prefix + '/echart/' + id;
			$.modal.open("超限线形图", url);
		}
		
        
    </script>
</body>
</html>